package com.example.demo.service;

import com.example.demo.entity.User;
import com.example.demo.mapper.UserMapper;
import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonAnyFormatVisitor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService {
    @Autowired
    private UserMapper userMapper;
    @Autowired
    private StringRedisTemplate redisUtil;
    public List<User> getAll(){
        int id = 2;
        return userMapper.getAllData(id);
    }
    public void getRedis(){
        User user = new User();
        user.setId(3);
        user.setName("test");
        redisUtil.opsForValue().set("name",user.toString());
         
        System.out.println(redisUtil.opsForValue().get("name")+1);
    }
}
